import ajax from '@lib/ajax';

const URL = "work/upgrade?id=";

interface IRequest {
	id: number;
	code: string;
	detail: string;
}

interface IResponse {
	id: number;
}

export default async function (req: IRequest) {
	const res = await ajax({
		url: URL + req.id,
		post: req
	});
	if (res.success) {
		const data = (res.data as IResponse);
		return data;
	} else {
		return new Error(res.error);
	}
}